CDIR=../../../..
INCDIR=$(CDIR)/include
CHARMC=$(CDIR)/bin/charmc $(OPTS)

LIB=libmoduleNDMeshStreamer.a
LIBOBJ=NDMeshStreamer.o

HEADERS= $(INCDIR)/NDMeshStreamer.decl.h \
         $(INCDIR)/NDMeshStreamer.def.h \
         $(INCDIR)/NDMeshStreamer.h \
	 $(INCDIR)/VirtualRouter.h \
         $(INCDIR)/DataItemTypes.h
LIBDEST = $(CDIR)/lib/$(LIB)

CIFILES = NDMeshStreamer.ci

all: $(LIBDEST) $(HEADERS)

$(INCDIR)/NDMeshStreamer.decl.h: NDMeshStreamer.decl.h
	/bin/cp NDMeshStreamer.decl.h $(CDIR)/include
$(INCDIR)/NDMeshStreamer.def.h: NDMeshStreamer.def.h
	/bin/cp NDMeshStreamer.def.h $(CDIR)/include
$(INCDIR)/NDMeshStreamer.h: NDMeshStreamer.h
	/bin/cp NDMeshStreamer.h $(CDIR)/include
$(INCDIR)/VirtualRouter.h: VirtualRouter.h
	/bin/cp VirtualRouter.h $(CDIR)/include
$(INCDIR)/DataItemTypes.h: DataItemTypes.h
	/bin/cp DataItemTypes.h $(CDIR)/include

$(LIBDEST): $(LIBOBJ)
	$(CHARMC) -o $(LIBDEST) $(LIBOBJ)
	/bin/cp libmoduleNDMeshStreamer.dep $(CDIR)/lib

NDMeshStreamer.def.h: NDMeshStreamer.decl.h

NDMeshStreamer.decl.h: NDMeshStreamer.ci $(CDIR)/bin/charmxi
	$(CHARMC) -c NDMeshStreamer.ci

clean:
	-rm -fr *.o *.decl.h *.def.h core $(LIB)

include Make.depends

DEPENDFILE = Make.depends

depends:  NDMeshStreamer.ci NDMeshStreamer.def.h
	echo "Creating " $(DEPENDFILE) " ..."; 	\
	if [ -f $(DEPENDFILE) ]; then \
           /bin/cp -f $(DEPENDFILE) $(DEPENDFILE).old; \
        fi; \
	echo '#generated by make depends' > $(DEPENDFILE); \
        for i in $(LIBOBJ) ; do \
	      SRCFILE=`basename $$i .o`.C ; \
              echo "checking dependencies for $$i : $$SRCFILE" ; \
              g++ -MM -Wno-deprecated -I$(CDIR)/tmp -I../completion $$SRCFILE >> $(DEPENDFILE); \
              echo '	$$(CHARMC) -I$(CDIR)/tmp -o '$$i $$SRCFILE >> $(DEPENDFILE) ; \
        done;

